if (!jsx3.lang.Class.forName("tibco.admin.enterpriseAssets.userMgt.user.SearchBar")) {
	jsx3.require("jsx3.gui.Block")
/**
*
*/
jsx3.lang.Package.definePackage("tibco.admin.enterpriseAssets.userMgt.user", function (searchbar) {
});

 /**
 * Extension of the <code>jsx3.gui.Block</code> class, the search groups sub component for user detail screen.
 */
jsx3.lang.Class.defineClass("tibco.admin.enterpriseAssets.userMgt.user.SearchBar",
        jsx3.gui.Block,
        null,
        function (searchbar) {

				/**
				 * instance initializer
				 */
				searchbar.prototype.initialize = function() {
                    // set the window instance id
                    if (jsx3.lang.Class.forName("tibco.admin.enterpriseAssets.userMgt.window.Window")) {
						this.windowObj = this.getAncestorOfType("tibco.admin.enterpriseAssets.userMgt.window.Window")
                        this.setWindowId(this.windowObj.getId());
						this.getParent().setZIndex(0, true);
                    }
                }
				
				/**
				 *   set the current window ID
				 *   @para strId {string} The window id
				 */
				searchbar.prototype.setWindowId = function(strId) {
                    this.windowId = strId;
                }


				/**
				 *   get the current window ID
				 *   @return {string} The window id
				 */
                searchbar.prototype.getWindowId = function() {
                    return this.windowId;
                }


				/**
				 * This function is to show and hide the serach bar
				 */
				searchbar.prototype.show = function(objEvent){
			       var searchLayer = this.getDescendantOfName("blkBtm_24_D_1");
					if((searchLayer.getVisibility()==jsx3.gui.Block.VISIBILITYHIDDEN))
					{
						searchLayer.setVisibility(jsx3.gui.Block.VISIBILITYVISIBLE, true);
						this.getParent().setZIndex(2, true); 
					}
					else
					{
						searchLayer.setVisibility(jsx3.gui.Block.VISIBILITYHIDDEN, true);
						this.getParent().setZIndex(0, true); 
					}
				}


				/**
				 *	To generate the search function and load the result dialog
				 */
				searchbar.prototype.doSearch = function(key){
					if(key.length==0)
						key = "*";
                    var loadTo = this.windowObj;
                    var body = tibco.admin.Main.getServer().getBodyBlock();
                    var parent = this.windowObj.getParent();
                    while(parent) {
                        if(parent == body) {
                            loadTo = body;
                            break;
                        }
                        parent = parent.getParent();
                    }
                    var addGroupPopup = tibco.admin.Main.loadUIResource(loadTo,"tibco.admin","tibco/admin/enterpriseAssets/userMgt/window/user/ui/addgroups.xml",true);
					addGroupPopup.setWindow( this.windowObj)
                    var searchKeyword = addGroupPopup.getDescendantOfName("txtKeyword_24_D_2");
					searchKeyword.setValue(key);
					addGroupPopup.callsearchGroups();

					var searchLayer = this.getDescendantOfName("blkBtm_24_D_1");
					if((searchLayer.getVisibility()==jsx3.gui.Block.VISIBILITYVISIBLE))
					{
						searchLayer.setVisibility(jsx3.gui.Block.VISIBILITYHIDDEN, true);
						this.getParent().setZIndex(0, true); 
					}
				}
        });
    }